What you've seen may be indicative of adware or other malware, that may
have found its way into the Safari extensions or add-ons due to visiting sites
that could have attached that kind of file to your browser. It is not a viri.
This Support page link covers general information + may help to resolve the issue;
it is kind of lengthy and requires a degree of attention to detail, for results.
• Stop pop-up ads and adware in Safari - Apple Support
Another item that may help, is a free product that appears to have helped with
this kind of issue in OS X, used to be known as Adware Medic and now is part
of a large adware & malware fighting group. Runs free, & may solve the issue:
http://www.adwaremedic.com/index.php - now known by a malwarebytes name.
Since nobody appears to have replied (sometimes the web site software won't
show when someone already had) I thought to add a reply at nearly 2:30AM...
Now it's time to consider sleep, even though vintage funny cartoons are on. 😎